<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看学生</title>
</head>
<body>
    <button onclick="window.location.href='/common/add_student/'">添加信息</button>
    <table>
        <tr>
            <th>名字</th>
            <th>性别</th>
            <th>电话</th>
            <th>班级</th>
            <th>学院</th>
            <th>操作</th>
        </tr>
        {% if stu_list %}
            {% for foo in stu_list %}
        <tr>
            <td>{{ foo.stu_name }}</td>
            {% if foo.gender %}
                <td>男</td>
            {% else %}
                <td>女</td>
            {% endif %}
            <td>{{ foo.stu_tel }}</td>
            <td>{{ foo.grade.grade_name }} </td>
            <td>{{ foo.collage.coll_name }}</td>
            <td>
                <a href="http://127.0.0.1:8000/common/del_student?sid={{ foo.stu_id }}">删除</a>
                |
                <a href="http://127.0.0.1:8000/common/edit_student?sid={{ foo.stu_id }}">编辑</a>
            </td>
        </tr>
            {% endfor %}
            {% else %}
                <tr>
                    暂无数据
                </tr>
            {% endif %}
        </table>
</body>
</html>